package com.ruoyi.web.controller.system;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.BEAnjuanOld;
import com.ruoyi.system.service.IBEAnjuanOldService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 电子旧案卷Controller
 * 
 * @author ruoyi
 * @date 2023-09-22
 */
@RestController
@RequestMapping("/system/oldeanjuan")
public class BEAnjuanOldController extends BaseController
{
    @Autowired
    private IBEAnjuanOldService bEAnjuanOldService;

    /**
     * 查询电子旧案卷列表
     */
//    //@PreAuthorize("@ss.hasPermi('system:oldeanjuan:list')")
    @GetMapping("/list")
    public TableDataInfo list(BEAnjuanOld bEAnjuanOld)
    {
        startPage();
        List<BEAnjuanOld> list = bEAnjuanOldService.selectBEAnjuanOldList(bEAnjuanOld);
        return getDataTable(list);
    }

    /**
     * 导出电子旧案卷列表
     */
//    //@PreAuthorize("@ss.hasPermi('system:oldeanjuan:export')")
    @Log(title = "电子旧案卷", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BEAnjuanOld bEAnjuanOld)
    {
        List<BEAnjuanOld> list = bEAnjuanOldService.selectBEAnjuanOldList(bEAnjuanOld);
        ExcelUtil<BEAnjuanOld> util = new ExcelUtil<BEAnjuanOld>(BEAnjuanOld.class);
        util.exportExcel(response, list, "电子旧案卷数据");
    }

    /**
     * 获取电子旧案卷详细信息
     */
//    //@PreAuthorize("@ss.hasPermi('system:oldeanjuan:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(bEAnjuanOldService.selectBEAnjuanOldById(id));
    }

    /**
     * 新增电子旧案卷
     */
//    //@PreAuthorize("@ss.hasPermi('system:oldeanjuan:add')")
    @Log(title = "电子旧案卷", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BEAnjuanOld bEAnjuanOld)
    {
        return toAjax(bEAnjuanOldService.insertBEAnjuanOld(bEAnjuanOld));
    }

    /**
     * 修改电子旧案卷
     */
//    //@PreAuthorize("@ss.hasPermi('system:oldeanjuan:edit')")
    @Log(title = "电子旧案卷", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BEAnjuanOld bEAnjuanOld)
    {
        return toAjax(bEAnjuanOldService.updateBEAnjuanOld(bEAnjuanOld));
    }

    /**
     * 删除电子旧案卷
     */
//    //@PreAuthorize("@ss.hasPermi('system:oldeanjuan:remove')")
    @Log(title = "电子旧案卷", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(bEAnjuanOldService.deleteBEAnjuanOldByIds(ids));
    }
}
